<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@page import="com.liuya.safe.policy.handler.QueryDesignHandler"%>
<%@page import="com.liuya.db.sql.xml.QueryType"%>
<%@page import="com.liuya.db.sql.xml.Table"%>
<%@page import="com.liuya.db.sql.xml.Column"%>
<%@page import="com.liuya.common.StringUtil"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Map"%>
<%@page import="java.util.HashMap"%>
<%@ page import="com.liuya.common.I18N" %>

<%
    I18N i18n = I18N.getInstance();
    QueryDesignHandler handler=(QueryDesignHandler) request.getAttribute( "handler" );
    QueryType query=handler.getQuery();
    String id=request.getParameter( "id" );

    Column[] columns=query.getQueryTypeSequence().getGroupBy().getColumn();
    Map aliasNameMap=new HashMap();
    Table[] tables=query.getQueryTypeSequence().getFrom().getTable();
    for( int i=0; i<tables.length; i++ ) {
        aliasNameMap.put( tables[i].getAlias(), tables[i].getName() );
    }
%>

<div class="treeDiv">
    <label><%=i18n.say( "Expression" )%></label>
    <ul id="exprGroup" class="tree"></ul>
</div>
<div class="editDiv">
    <div id="whereExprContextMenu"></div>
</div>

<div class="clearDiv"></div>
<script type="text/javascript">
    jQuery( document ).ready( function() {
        var whereTreeSetting={
            async: true,
            /**editable: true,
             edit_renameBtn: false,
             edit_removeBtn: false,
             dragMove: true,*/
            isSimpleData: true,
            treeNodeKey: "id",
            treeNodeParentKey: "pId",
            asyncUrl: "loadWhereExprGroup.do?oper=loadWhereExprGroup&id=<%=id%>",
            callback:{
                click: clickWhereExprTree
            },
            asyncParam: ["name", "id"]
        };

        var whereNodes=[];
        jQuery("#exprGroup").zTree(whereTreeSetting, whereNodes);
    } );


</script>